import { http } from "@/utils/http";

export type Result = {
  success: boolean;
  message: string;
  data?: [];
};

const modulePath = "/upload/attachments";

/** 上传文件 */
export const uploadAttachments = (data?: object, options?: object) => {
  return http.post(
    modulePath,
    { data },
    {
      ...options,
      headers: {
        "Content-Type": "multipart/form-data"
      }
    }
  );
};

/** 获取业务id列表 */
export const getBusinessIdList = (params?: { businessId: number }) => {
  return http.request<Result>("get", modulePath + "/businessIdList", {
    params
  });
};

/** 获取业务id列表 */
export const deleteFileAttachmentById = (data?: { id: number }) => {
  return http.request<Result>(
    "delete",
    modulePath + "/deleteFileAttachmentById",
    {
      data
    }
  );
};
